package org.act.xservices.rt.xcontainer.framework.dispatcher;

/**
 * Safe executables represent blocks of code and associated exception
 * handlers.  They are typically used when it needs to call some
 * untrusted code.
 * 
 * @version 1.0 2007-3-20
 * @author liujian[liujian@act.buaa.edu.cn]
 * @author Lizq [lizq@act.buaa.edu.cn]
 * @since JDK1.5
 */
public interface ISafeDispatchWorker extends Runnable{
	
	/**
	 * Execute this executable.  Any exceptions thrown from this method will
	 * be passed to this executable <code>handleException</code>
	 * method.
	 *
	 * @exception Exception if a problem occurred while running this method.
	 *		The exception will be processed by <code>handleException</code>
	 */
	public void execute() throws Exception;
	
	
	
	
	/**
	 * Handles an exception thrown by this runnable's <code>run</code>
	 * method.  The processing done here should be specific to the
	 * particular usecase for this runnable.  Generalized exception
	 * processing (e.g., logging) is done by the applications
	 *
	 * @param exception an exception which occurred during processing
	 *		the body of this runnable (i.e., in <code>execute()</code>)
	 */
	public void handleException(Throwable exception);


}